import { AxiosInstance } from '../axios_helper/types';
import Axios from './Axios';
import { extend } from '../axios_helper/util';

function createInstance(): AxiosInstance {
  const context = new Axios();
  const instance = Axios.prototype.request.bind(context);

  extend(instance, context);

  return instance as AxiosInstance;
}

const axios = createInstance();

export default axios;
export * from '../axios_helper/types';